package com.sunwayworld.core.login.web.action;

import com.sunwayworld.common.struts2.BaseAction;
import com.sunwayworld.core.login.service.LoginManager;

public class LoginAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String username;

	private String password;

	private LoginManager loginManager = null;

	@Override
	public String execute() {
		if (loginManager.checkLogin(username, password)) {
			return SUCCESS;
		} else {
			return ERROR;
		}
	}
	/**
	 * 跳转到新增页面
	 * @return detail
	 */
	public String toCreate() {
		return "detail";
	}
	/**
	 * 跳转到更新页面
	 * @return detail
	 */
	public String toUpdate() {
		return "detail";
	}
	/**
	 * 跳转到详细页面
	 * @return detail
	 */
	public String toDetail() {
		return "detail";
	}
	/**
	 * 跳转到列表页面
	 * @return list
	 */
	public String toList() {
		return "list";
	}
	/**
	 * 新增 
	 * @return detail
	 */
	public String create() {
		return toUpdate();
	}
	/**
	 * 更新 
	 * @return detail
	 */
	public String update() {
		return toUpdate();
	}
	/**
	 * 删除 
	 * @return list
	 */
	public String delete() {
		return toList();
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setLoginManager(LoginManager loginManager) {
		this.loginManager = loginManager;
	}

}
